{% load i18n template_page_slice_tags template_string_tags %}

{% if page %}
    {% page_slices page as page_slices %}
    {% if page_slices %}
        <div class="paginator pages-{% for slice in page_slices %}{{ slice|length }}{% endfor %}">
            <ul class="pages">
                {% if page.has_previous %}
                    {# <li class="first-page"><a href="{% filter normalize_space %}{% with 1 as page_number %}{% if page_link_template %}{% include page_link_template %}{% else %}{% include 'common/paginator/paginator_link.html' %}{% endif %}{% endwith %}{% endfilter %}">{% trans "erste Seite" %}</a></li> #}
                    <li class="previous-page"><a href="{% filter normalize_space %}{% with page.previous_page_number as page_number %}{% if page_link_template %}{% include page_link_template %}{% else %}{% include 'common/paginator/paginator_link.html' %}{% endif %}{% endwith %}{% endfilter %}">{% trans "vorherige Seite" %}</a></li>
                {% endif %}
                {% for slice in page_slices %}
                    {% for spage in slice %}
                        {% ifequal spage page.number %}
                            <li class="page current"><span>{{ spage }}</span></li>
                        {% else %}
                            <li class="page"><a href="{% filter normalize_space %}{% with spage as page_number %}{% if page_link_template %}{% include page_link_template %}{% else %}{% include 'common/paginator/paginator_link.html' %}{% endif %}{% endwith %}{% endfilter %}">{{ spage }}</a></li>
                        {% endifequal %}
                    {% endfor %}
                    {% if not forloop.last %}
                        <li class="page-ellipsis"><span>…</span></li>
                    {% endif %}
                {% endfor %}
                {% if page.has_next %}
                    <li class="next-page"><a href="{% filter normalize_space %}{% with page.next_page_number as page_number %}{% if page_link_template %}{% include page_link_template %}{% else %}{% include 'common/paginator/paginator_link.html' %}{% endif %}{% endwith %}{% endfilter %}">{% trans "nächste Seite" %}</a></li>
                    {# <li class="last-page"><a href="{% filter normalize_space %}{% with page.paginator.num_pages as page_number %}{% if page_link_template %}{% include page_link_template %}{% else %}{% include 'common/paginator/paginator_link.html' %}{% endif %}{% endwith %}{% endfilter %}">{% trans "letzte Seite" %}</a></li> #}
                {% endif %}
            </ul>
            <div class="clear"></div>
        </div>
    {% endif %}
	<div class="clear"></div>
{% endif %}
